/**
 * 
 */
package org.lex.app;

import java.util.HashMap;
import java.util.Map;

import javax.swing.ActionMap;

/**
 * @author Daniel Liu
 */
public class ActionManager {
	private ActionMap globalActionMap = null;
	private Map<Class<?>, ActionMap> actionMaps = null;

	public ActionManager() {
		this.globalActionMap = new ActionMap();
		this.actionMaps = new HashMap<Class<?>, ActionMap>();
	}

	public ActionMap getActionMap() {
		return this.globalActionMap;
	}

	public ActionMap getActionMap(Class<?> key) {
		ActionMap am = this.actionMaps.get(key);
		if (null == am) {
			am = new ActionMap();
			am.setParent(this.getActionMap());
			this.actionMaps.put(key, am);
		}
		return am;
	}
}
